package _15_generics._15_7.exercise;

/**
 * Create an interface with two methods, and a class
 * that implements that interface and adds another
 * method. In another class,create a generic method
 * with an argument type that is bounded by the
 * interface, and show that the methods in the
 * interface are callable inside this generic method.
 * In main(),pass an instance of the implementing
 * class to the generic method.
 */
public class E20_Bounds {
    static <T extends Top> void f(T  obj){
        obj.a();
        obj.b();
    }

    public static void main(String[] args) {
        f(new CombinedImpl());
    }
}

interface Top {
    void a();

    void b();
}

class CombinedImpl implements Top {

    @Override
    public void a() {
        System.out.println("CombinedImpl::a()");
    }

    @Override
    public void b() {
        System.out.println("CombinedImpl::b()");
    }

    public void c(){
        System.out.println("CombinedImpl::c()");
    }
}
